#!/bin/bash

if [ -f /root/.ssh/id_rsa ];then
	rm -rf /root/.ssh/id_rsa*
fi
ssh-keygen -t rsa -f /root/.ssh/id_rsa -P "" &>/dev/null
if [ -f /root/.ssh/known_hosts ];then 
	> /root/.ssh/known_hosts
fi

for i in 11 12 ;do
/usr/bin/expect << eof
set timeout 5
spawn ssh-copy-id root@192.168.140.$i
expect "(yes/no)"
send "yes\n"
expect "password:"
send "redhat\n"
expect eof
eof
done
